<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 15-6-18
 * Time: 下午4:11
 * @author 郑钟良<zzl@ourstu.com>
 */

namespace Addons\Consult\Model;


use Think\Model;

class ConsultCategoryModel extends Model
{
    public function editData($data)
    {
        if($data['id']){
            $res=$this->save($data);
        }else{
            $res=$this->add($data);
        }
        return $res;
    }

    public function getData($id)
    {
        $data=$this->find($id);
        $data['use_space']=str_replace('[','',$data['use_space']);
        $data['use_space']=str_replace(']','',$data['use_space']);
        return $data;
    }

    public function getList($map,$order='sort desc')
    {
        $list=$this->where($map)->order($order)->select();
        return $list;
    }
} 